import React from "react";
import { Provider, Contexts } from "./context";
import Comp from "./component1";

const ProviderComp = Provider;

const App = () => {
  const { state, dispatch } = Contexts();

  return (
    <div>
      <p>
        <button
          type="button"
          onClick={() => {
            dispatch({ type: "upgrade", payload: { age: state.age + 1 } });
          }}
        >
          age incre
        </button>
      </p>
      <Comp />
    </div>
  );
};

export default () => {
  return (
    <ProviderComp>
      <App></App>
    </ProviderComp>
  );
};
